<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>对称的二叉树</title>
</head>
<body>
  <script>
    function fn(root) {
      const ans = (left, right) => {
        if (!left && !right) {
          return true
        }
        if (!left || !right || left.val !== right.val) {
          return false
        }
        return ans(left.left, right.right) && ans(left.right, right.left)
      }
      return ans(root, root)
    }
    console.log(fn([1,2,2,3,4,4,3]))
  </script>
</body>
</html>